package com.ruoyi.testDeal.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.testDeal.domain.equInfo.JkTfjInfo;
import com.ruoyi.testDeal.service.IJkTfjInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 金属非金属通风机参数信息Controller
 * 
 * @author ruoyi
 * @date 2024-04-07
 */
@RestController
@RequestMapping("/testDeal/jkTfjInfo")
public class JkTfjInfoController extends BaseController
{
    @Autowired
    private IJkTfjInfoService jkTfjInfoService;

    /**
     * 查询金属非金属通风机参数信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(JkTfjInfo jkTfjInfo)
    {
        startPage();
        List<JkTfjInfo> list = jkTfjInfoService.selectJkTfjInfoList(jkTfjInfo);
        return getDataTable(list);
    }

    /**
     * 导出金属非金属通风机参数信息列表
     */
    @Log(title = "金属非金属通风机参数信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JkTfjInfo jkTfjInfo)
    {
        List<JkTfjInfo> list = jkTfjInfoService.selectJkTfjInfoList(jkTfjInfo);
        ExcelUtil<JkTfjInfo> util = new ExcelUtil<JkTfjInfo>(JkTfjInfo.class);
        util.exportExcel(response, list, "金属非金属通风机参数信息数据");
    }

    /**
     * 获取金属非金属通风机参数信息详细信息
     */
    @GetMapping(value = "/{tfjId}")
    public AjaxResult getInfo(@PathVariable("tfjId") Long tfjId)
    {
        return success(jkTfjInfoService.selectJkTfjInfoByTfjId(tfjId));
    }

    /**
     * 新增金属非金属通风机参数信息
     */
    @Log(title = "金属非金属通风机参数信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JkTfjInfo jkTfjInfo)
    {
        return toAjax(jkTfjInfoService.insertJkTfjInfo(jkTfjInfo));
    }

    /**
     * 修改金属非金属通风机参数信息
     */
    @Log(title = "金属非金属通风机参数信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JkTfjInfo jkTfjInfo)
    {
        return toAjax(jkTfjInfoService.updateJkTfjInfo(jkTfjInfo));
    }

    /**
     * 删除金属非金属通风机参数信息
     */
    @Log(title = "金属非金属通风机参数信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{tfjIds}")
    public AjaxResult remove(@PathVariable Long[] tfjIds)
    {
        return toAjax(jkTfjInfoService.deleteJkTfjInfoByTfjIds(tfjIds));
    }
}
